package com.tj.collection.enums;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: WatsonQiu
 * Date: 2017/7/22
 * Time: 下午2:16
 */
public enum OrderStatusEnums {

    UNCLEARED(0, "未结清"),
    CLEARED(1, "已结清"),
    LOCKED(2, "已锁定");

    private Integer type;

    private String desc;

    OrderStatusEnums(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public OrderStatusEnums setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public OrderStatusEnums setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static OrderStatusEnums getEnum(Integer type) {
        for (OrderStatusEnums item : OrderStatusEnums.values()) {
            if (item.type.equals(type)) {
                return item;
            }
        }
        return null;
    }

    public static String getName(Integer type) {
        OrderStatusEnums item = getEnum(type);
        return item != null ? item.desc : null;
    }
}
